/**
 * @file   1054.cpp
 * @author Shuang Hu <hsmath@ubuntu>
 * @date   Fri May 21 23:45:28 2021
 * 
 * @brief  PAT 1054
 * 
 * 
 */
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<string>
using namespace std;
int main(){
    int M,N;
    cin>>M>>N;
    vector<vector<string>> Figure;
    for(int i=0;i<N;i++){
	vector<string> Line;
	for(int j=0;j<M;j++){
	    string s;
	    cin>>s;
	    Line.push_back(s);
	}
	Figure.push_back(Line);
    }
    map<string,int> times;
    for(int i=0;i<N;i++){
	for(int j=0;j<M;j++){
	    times[Figure[i][j]]++;
	}
    }
    for(auto it=times.begin();it!=times.end();it++){
	int t=(M*N)/2;
	if((M*N)%2){t++;}
	if(times[it->first]>=t){
	    cout<<it->first<<endl;
	    break;
	}
    }
}
